perm filename MANTMP.MF[MF,DEK] blob
sn#468990 filedate 1979-08-27 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00003 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 proofmode drawdisplay
C00007 00003 pixels=36 blacker=0 s=0 grid=1 mi=0 extra=2
C00010 ENDMK
C⊗;
proofmode; drawdisplay;
% Basic subroutines for Computer Modern Fonts
eps=.000314159; % small positive number
subroutine fontbegin:
no eqtrace; no calltrace;
new cf,typesize,h,c,e,d,a,b,w0,w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11;
typesize=rh+rd+2rb; cf.typesize=pixels.typesize-1;
h=round cf.rh; c=round cf.rc; e=round cf.re;
d=round cf.rd; a=round cf.ra; b=round cf.rb;
w0=.5+round(pixels.rw+blacker);
w1=.5+round(pixels.rwi+blacker);
w2=.5+round(pixels.rwii+blacker);
w3=.5+round(pixels.rwiii+blacker);
w4=.5+round(pixels.rwiv+blacker);
w5=.5+round(pixels.rwv+blacker);
w6=.5+round(pixels.rwvi+blacker);
w7=.5+round(pixels.rwvii+blacker);
w8=.5+round(pixels.rwviii+blacker);
w9=.5+round(pixels.rwix+blacker);
w10=.5+round(pixels.rwx+blacker);
w11=.5+round(pixels.rwxi+blacker);
trxy slant.
subroutine charbegin(var charno, var charuw, var lftcorr, var rtcorr,
var charh, var chard, var chari):
no eqtrace; no calltrace; no proofmode;
new uw,r,u,italcorr;
r=charuw.u;
uw = charuw-(lftcorr+rtcorr); % width of character in units
italcorr = chari+mi.ru/2; % add half unit to italic correction if mathitalic
charht charh; chardp chard;
if italcorr≥0: charic italcorr; else: charic 0; fi;
if fixwidth≠0: u.uw = 9ru.pixels-1; charwd 9ru; % leave one pixel of extra space
else: u.uw = uw.ru.pixels-1; charwd uw.ru; fi;
incx round(-lftcorr.ru.pixels);
if grid≠0: call box(round lftcorr.ru.pixels); fi.
subroutine box(var offset): % draws grid lines and box around a character
no drawtrace;
new topp,bottom,left,right,pos;
topp=h+b; bottom=-d-b; left=offset; right=offset+u.uw;
x1=x3=x5=x7=x9=x11=x13=x15=x16=left;
x2=x4=x6=x8=x10=x12=x14=x17=x18=right;
y1=y2=0; cpen; 1 draw 1..2; % baseline
y3=y4=e; draw 3..4; % e-line
y5=y6=c; draw 5..6; % x-height
y7=y8=h; draw 7..8; % h-height
y9=y10=topp; draw 9..10; % top of character
y11=y12=-d; draw 11..12; % descender depth
y13=y14=bottom; draw 13..14; % bottom of character
trxy 0; y15=y17=topp; y16=y18=bottom; draw 15..16; % left edge of character
draw 17..18; % right edge of character
trxy slant;
pos=0; call vertloop;
if italcorr>0: trxy 0;
x19=x20=right+italcorr.pixels; y19=topp; y20=0; draw 19..20; % show italic corr
trxy slant; fi.
subroutine vertloop: % recursive subroutine to draw vertical lines at unit intervals
x1=x2=pos; y1=topp; y2=bottom; cpen; if pos≥left: 1 draw 1..2; fi;
new pos; pos=x1+u; if pos≤right: call vertloop; fi.
subroutine serif(index i, index k, index j, var sl):
y1=yi; if yi<yj: y2=yi+rs.pixels; else: y2=yi-rs.pixels; fi;
hpen; if sl<0: lft0x1=lft k xi + sl.u-eps; lft0x2=lft k(y2-yi)/(yj-yi)[xi,xj];
else: rt0x1=rt k xi + sl.u+eps; rt0x2=rt k(y2-yi)/(yj-yi)[xi,xj]; fi;
no proofmode; x3=1/3[x1-sl.u,1/2[x1,x2]]; y3=1/3[yi,1/2[y1,y2]];
minvr 0; minvs 0; w0 ddraw 1{xi-x1,0}..3..2{xj-xi,yj-yi}, 1..i..i; minvr .5; minvs .5.
subroutine darc(index i, index j, var maxwidth):
x1=x5=xi; x2=x4=1/sqrttwo[xi,xj]; x3=xj;
y1=yi; y5=yj; y3=1/2[yi,yj]; y2=1/sqrttwo[y3,yi]; y4=1/sqrttwo[y3,yj];
hpen; draw |w0| 1 {x3-x1,0}..|2/3[w0,maxwidth]| 2 {x3-x1,y3-y1} ..
|maxwidth#| 3 {0,y3-y1} .. |2/3[w0,maxwidth]| 4 {x5-x3,y5-y3} ..
|w0| 5 {x5-x3,0}.
pixels=36; blacker=0; s=0; grid=1; mi=0; extra=2;
rh=250/36; rc=160/36; re=90/36; rd=70/36; ra=.5(rh-rd); rb=20/36; ru=20/36; % 10pt
ro=4/36; rs=20/36;
rw=9/36; rwi=27/36; rwii=32/36; rwiii=36/36;
rwiv=9/36; rwv=27/36; rwvi=32/36; rwvii=36/36;
rwviii=32/36; rwix=38/36; rwx=32/36; rwxi=38/36;
lcs=1.075; ucs=1.7; sc=0; slant=0; fixwidth=0; sqrttwo=sqrt2;
call fontbegin.
"The letter A";
call charbegin('101,13,2.sc+1.5.mi,2.sc,rh,0,0);
eqtrace;
hpen;
lft0x1=round(1.5u+0); bot0y1=round 0;
rt9x4=round(r-1.5u+0); bot9y4=round 0;
x3-x1=x4-x2+0;
rt9x2=rt0x3;
top0y3=top9y2=h+0+2extra;
w9 draw 2..4; % right diagonal stroke
y5=e+0; y6=e+0;
x5-1=(y5-y1)/(y3-y1)[x1,x3];
x6+1=(y6-y4)/(y2-y4)[x4,x2];
w0 draw 5..6; % bar line
lers; w9 draw 3..5; % erase excess at left
hpen; w0 draw 3..1; % left diagonal stroke
if ucs>0: call `a serif(1,0,3,-.5ucs); call `b serif(1,0,3,+ucs);
call `c serif(4,9,2,-ucs); call `d serif(4,9,2,+.5ucs);
fi.
"The letter B";
call charbegin('102,12,2.sc+1.5.mi,0,rh,0,h.slant-2ru);
hpen; lft8x1=round(2u+0); top8y1=round(h+0);
lft8x2=round(2u+0); bot8y2=round 0; w8 draw 1..2; % stem
call `a serif(1,8,2,-ucs); call `b serif(1,8,2,.5ucs);
call `c serif(2,8,1,-ucs); call `d serif(2,8,1,.5ucs);
x3=1/2[2u,r]+0; rt9x4=round(r-u+0); y3=y1+0; y4=good0 1/2h+0;
w0 draw 1..3; call `e darc(3,4,w9); % upper bar line, upper counter
y5=y4=y6; x5=x1;
x6=x3+1/2u;
rt9x7=round(r-1/2u+0); bot0y7=0;
w0 draw 5..6; call `f darc(6,7,w9); % middle bar line, lower counter
x8=x6; y8=y7; w0 draw 2..8. % lower bar line